# eric7.DataViews.PyCoverageDialog

Module implementing a Python code coverage dialog.

### Global Attributes

None

### Classes

PyCoverageDialog | Class implementing a dialog to display the collected code coverage data.

### Functions

None

## PyCoverageDialog

Class implementing a dialog to display the collected code coverage data.

### Signals

openFile(str)
  emitted to open the given file in an editor

### Derived from

QDialog, Ui_PyCoverageDialog

### Class Attributes

None

### Class Methods

None

### Methods

PyCoverageDialog | Constructor
__createResultItem | Private method to create an entry in the result list.
__erase | Private slot to handle the erase context menu action.
__finish | Private slot called when the action finished or the user pressed the button.
__format_lines | Private method to format a list of integers into string by coalescing groups.
__htmlReport | Private slot to generate a HTML report of the shown data.
__jsonReport | Private slot to generate a JSON report of the shown data.
__lcovReport | Private slot to generate a LCOV report of the shown data.
__openFile | Private slot to open the selected file.
__prepareReportGeneration | Private method to prepare a report generation.
__showContextMenu | Private slot to show the context menu of the listview.
closeEvent | Protected method to handle the close event.
on_buttonBox_clicked | Private slot called by a button of the button box clicked.
on_reloadButton_clicked | Private slot to reload the coverage info.
on_resultList_itemActivated | Private slot to handle the activation of an item.
start | Public slot to start the coverage data evaluation.
stringify | Private helper function to generate a string representation of a pair.

### Static Methods

None

#### PyCoverageDialog (Constructor)

PyCoverageDialog(parent=None)

Constructor

parent (QWidget)
  parent widget

#### PyCoverageDialog.__createResultItem

__createResultItem(file, statements, executed, coverage, excluded, missing)

Private method to create an entry in the result list.

file (str)
  filename of file
statements (int)
  number of statements
executed (int)
  number of executed statements
coverage (int)
  percent of coverage
excluded (list of int)
  list of excluded lines
missing (str)
  list of lines without coverage

#### PyCoverageDialog.__erase

__erase()

Private slot to handle the erase context menu action.

This method erases the collected coverage data that is stored in the .coverage file.

#### PyCoverageDialog.__finish

__finish()

Private slot called when the action finished or the user pressed the button.

#### PyCoverageDialog.__format_lines

__format_lines(lines)

Private method to format a list of integers into string by coalescing groups.

lines (list of int)
  list of integers

Return:
  string representing the list

Return Type:
  str

#### PyCoverageDialog.__htmlReport

__htmlReport()

Private slot to generate a HTML report of the shown data.

#### PyCoverageDialog.__jsonReport

__jsonReport()

Private slot to generate a JSON report of the shown data.

#### PyCoverageDialog.__lcovReport

__lcovReport()

Private slot to generate a LCOV report of the shown data.

#### PyCoverageDialog.__openFile

__openFile(itm=None)

Private slot to open the selected file.

itm (QTreeWidgetItem)
  reference to the item to be opened

#### PyCoverageDialog.__prepareReportGeneration

__prepareReportGeneration()

Private method to prepare a report generation.

Return:
  tuple containing a reference to the Coverage object and the list of files to report

Return Type:
  tuple of (Coverage, list of str)

#### PyCoverageDialog.__showContextMenu

__showContextMenu(coord)

Private slot to show the context menu of the listview.

coord (QPoint)
  position of the mouse pointer

#### PyCoverageDialog.closeEvent

closeEvent(_evt)

Protected method to handle the close event.

_evt (QCloseEvent)
  reference to the close event (unused)

#### PyCoverageDialog.on_buttonBox_clicked

on_buttonBox_clicked(button)

Private slot called by a button of the button box clicked.

button (QAbstractButton)
  button that was clicked

#### PyCoverageDialog.on_reloadButton_clicked

on_reloadButton_clicked()

Private slot to reload the coverage info.

#### PyCoverageDialog.on_resultList_itemActivated

on_resultList_itemActivated(item, _column)

Private slot to handle the activation of an item.

item (QTreeWidgetItem)
  reference to the activated item
_column (int)
  column the item was activated in (unused)

#### PyCoverageDialog.start

start(cfn, fn)

Public slot to start the coverage data evaluation.

cfn (str)
  basename of the coverage file
fn (str or list of str)
  file or list of files or directory to be checked

#### PyCoverageDialog.stringify

stringify()

Private helper function to generate a string representation of a pair.

pair (tuple of (int, int)
  pair of integers

Return:
  representation of the pair

Return Type:
  str

Up